package com.xu.junit;

import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;

import java.util.Arrays;
import java.util.Collection;

/**
 * @RunWith(Parameterized.class) 
 */
@RunWith(Parameterized.class) 
public class JUnitStudy3_Parameterized {

	private int i;  
    private int j;  
  
    //构造函数  
    public JUnitStudy3_Parameterized(int i, int j) {  
        super();  
        this.i = i;  
        this.j = j;  
    }  
  
    //测试数据集合，注意使用的注解，数据结构及次序  
    @Parameters  
    public static Collection<Object[]> data() {  
        return Arrays.asList(new Object[][]{{1,2},{3,4},{4,6}});  
    }  
    
    @Test  
    public void testMethod1() {  
        System.out.println(i);
        System.out.println(j);
        //简单测试，只测试参数加1会不会等于预期结果  
        Assert.assertEquals(i+1, j);  
    }  
}
